package day0716;

import java.util.HashMap;
import java.util.Map;

public class Demo01 {
	public static void main(String[] args) {
		// HashMap中key唯一,需要重写hashcode和equals
		HashMap<User, Integer> hashMap = new HashMap<>();
		hashMap.put(new User("金咸鱼", 40), 99999);
		hashMap.put(new User("一猫人", 20), 707070);
		hashMap.put(new User("一猫人", 20), 606060);
		hashMap.put(new User("被告", 40), 1);
		hashMap.put(new User("原告", 40), 99);
		hashMap.put(new User("控制", 40), 999);

		for (Map.Entry<User, Integer> entry : hashMap.entrySet()) {
			System.out.println(entry.getKey() + "_" + entry.getValue());
		}
	}
}
